package middleware

import (
	"net/http"
)

type UserAgentMiddleware struct {
}

func NewUserAgentMiddleware() *UserAgentMiddleware {
	return &UserAgentMiddleware{}
}

func (m *UserAgentMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		// TODO generate middleware implement function, delete after code implementation
		/*	token := r.Header.Get("token")
			tokenHandler, err := pkg.TokenHandler(token)
			if err != nil {
				response := types.Response{
					Message: err.Error(),
					Code:    500,
					Data:    nil,
				}
				httpx.OkJsonCtx(r.Context(), w, response)
				return
			}
			getToken, s := pkg.GetToken(tokenHandler)
			if s != "" {
				response := types.Response{
					Message: s,
					Code:    500,
					Data:    nil,
				}
				httpx.OkJsonCtx(r.Context(), w, response)
				return
			}
			json.Unmarshal("userID", getToken["userID"](string))*/
		// Passthrough to next handler if need
		next(w, r)
	}
}
